
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

Public MustInherit Class _PersonNat
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "PersonNat"
			Me.MappingName = "PersonNat"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_PersonNatLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
	Public Overridable Function LoadByPrimaryKey(ByVal IdPersona As String) As Boolean

		Dim parameters As ListDictionary = New ListDictionary()
		parameters.Add(_PersonNat.Parameters.IdPersona, IdPersona)

		
		Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_PersonNatLoadByPrimaryKey]", parameters)

	End Function

	#Region "Parameters"
	Protected class Parameters 
		
		Public Shared ReadOnly Property IdPersona As SqlParameter
			Get
				Return New SqlParameter("@IdPersona", SqlDbType.Char, 7)
			End Get
		End Property
		
		Public Shared ReadOnly Property ApePat As SqlParameter
			Get
				Return New SqlParameter("@ApePat", SqlDbType.VarChar, 35)
			End Get
		End Property
		
		Public Shared ReadOnly Property ApeMat As SqlParameter
			Get
				Return New SqlParameter("@ApeMat", SqlDbType.VarChar, 35)
			End Get
		End Property
		
		Public Shared ReadOnly Property Nombres As SqlParameter
			Get
				Return New SqlParameter("@Nombres", SqlDbType.VarChar, 40)
			End Get
		End Property
		
		Public Shared ReadOnly Property Sexo As SqlParameter
			Get
				Return New SqlParameter("@Sexo", SqlDbType.Char, 1)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdTipDocId As SqlParameter
			Get
				Return New SqlParameter("@IdTipDocId", SqlDbType.Char, 4)
			End Get
		End Property
		
		Public Shared ReadOnly Property NroDocId As SqlParameter
			Get
				Return New SqlParameter("@NroDocId", SqlDbType.Char, 11)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdEstCivil As SqlParameter
			Get
				Return New SqlParameter("@IdEstCivil", SqlDbType.Char, 4)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdGradInst As SqlParameter
			Get
				Return New SqlParameter("@IdGradInst", SqlDbType.Char, 4)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdProfesion As SqlParameter
			Get
				Return New SqlParameter("@IdProfesion", SqlDbType.Char, 4)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdOcupacion As SqlParameter
			Get
				Return New SqlParameter("@IdOcupacion", SqlDbType.Char, 4)
			End Get
		End Property
		
		Public Shared ReadOnly Property IdUser As SqlParameter
			Get
				Return New SqlParameter("@IdUser", SqlDbType.Char, 6)
			End Get
		End Property
		
		Public Shared ReadOnly Property Fecpro As SqlParameter
			Get
				Return New SqlParameter("@Fecpro", SqlDbType.DateTime, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property Hora As SqlParameter
			Get
				Return New SqlParameter("@Hora", SqlDbType.Char, 8)
			End Get
		End Property
		
	End Class
	#End Region	

	#Region "ColumnNames"
	Public class ColumnNames
		
        Public Const IdPersona As String = "IdPersona"
        Public Const ApePat As String = "ApePat"
        Public Const ApeMat As String = "ApeMat"
        Public Const Nombres As String = "Nombres"
        Public Const Sexo As String = "Sexo"
        Public Const IdTipDocId As String = "IdTipDocId"
        Public Const NroDocId As String = "NroDocId"
        Public Const IdEstCivil As String = "IdEstCivil"
        Public Const IdGradInst As String = "IdGradInst"
        Public Const IdProfesion As String = "IdProfesion"
        Public Const IdOcupacion As String = "IdOcupacion"
        Public Const IdUser As String = "IdUser"
        Public Const Fecpro As String = "Fecpro"
        Public Const Hora As String = "Hora"

		Shared Public Function ToPropertyName(ByVal columnName As String) As String

			If ht Is Nothing Then
			
				ht = new Hashtable
				
				ht(IdPersona) = _PersonNat.PropertyNames.IdPersona
				ht(ApePat) = _PersonNat.PropertyNames.ApePat
				ht(ApeMat) = _PersonNat.PropertyNames.ApeMat
				ht(Nombres) = _PersonNat.PropertyNames.Nombres
				ht(Sexo) = _PersonNat.PropertyNames.Sexo
				ht(IdTipDocId) = _PersonNat.PropertyNames.IdTipDocId
				ht(NroDocId) = _PersonNat.PropertyNames.NroDocId
				ht(IdEstCivil) = _PersonNat.PropertyNames.IdEstCivil
				ht(IdGradInst) = _PersonNat.PropertyNames.IdGradInst
				ht(IdProfesion) = _PersonNat.PropertyNames.IdProfesion
				ht(IdOcupacion) = _PersonNat.PropertyNames.IdOcupacion
				ht(IdUser) = _PersonNat.PropertyNames.IdUser
				ht(Fecpro) = _PersonNat.PropertyNames.Fecpro
				ht(Hora) = _PersonNat.PropertyNames.Hora

			End If
			
			Return CType(ht(columnName), String)
			
		End Function
		
		Shared Private ht  As Hashtable = Nothing		 
	End Class
	#End Region	
	
	#Region "PropertyNames"
	Public class PropertyNames
		
        Public Const IdPersona As String = "IdPersona"
        Public Const ApePat As String = "ApePat"
        Public Const ApeMat As String = "ApeMat"
        Public Const Nombres As String = "Nombres"
        Public Const Sexo As String = "Sexo"
        Public Const IdTipDocId As String = "IdTipDocId"
        Public Const NroDocId As String = "NroDocId"
        Public Const IdEstCivil As String = "IdEstCivil"
        Public Const IdGradInst As String = "IdGradInst"
        Public Const IdProfesion As String = "IdProfesion"
        Public Const IdOcupacion As String = "IdOcupacion"
        Public Const IdUser As String = "IdUser"
        Public Const Fecpro As String = "Fecpro"
        Public Const Hora As String = "Hora"

		Shared Public Function ToColumnName(ByVal propertyName As String) As String

			If ht Is Nothing Then
			
				ht = new Hashtable
				
				ht(IdPersona) = _PersonNat.ColumnNames.IdPersona
				ht(ApePat) = _PersonNat.ColumnNames.ApePat
				ht(ApeMat) = _PersonNat.ColumnNames.ApeMat
				ht(Nombres) = _PersonNat.ColumnNames.Nombres
				ht(Sexo) = _PersonNat.ColumnNames.Sexo
				ht(IdTipDocId) = _PersonNat.ColumnNames.IdTipDocId
				ht(NroDocId) = _PersonNat.ColumnNames.NroDocId
				ht(IdEstCivil) = _PersonNat.ColumnNames.IdEstCivil
				ht(IdGradInst) = _PersonNat.ColumnNames.IdGradInst
				ht(IdProfesion) = _PersonNat.ColumnNames.IdProfesion
				ht(IdOcupacion) = _PersonNat.ColumnNames.IdOcupacion
				ht(IdUser) = _PersonNat.ColumnNames.IdUser
				ht(Fecpro) = _PersonNat.ColumnNames.Fecpro
				ht(Hora) = _PersonNat.ColumnNames.Hora

			End If
			
			Return CType(ht(propertyName), String)
			
		End Function
		
		Shared Private ht  As Hashtable = Nothing
		
	End Class
	#End Region	
	
	#Region "StringPropertyNames"
	Public class StringPropertyNames
		
        Public Const IdPersona As String = "s_IdPersona"
        Public Const ApePat As String = "s_ApePat"
        Public Const ApeMat As String = "s_ApeMat"
        Public Const Nombres As String = "s_Nombres"
        Public Const Sexo As String = "s_Sexo"
        Public Const IdTipDocId As String = "s_IdTipDocId"
        Public Const NroDocId As String = "s_NroDocId"
        Public Const IdEstCivil As String = "s_IdEstCivil"
        Public Const IdGradInst As String = "s_IdGradInst"
        Public Const IdProfesion As String = "s_IdProfesion"
        Public Const IdOcupacion As String = "s_IdOcupacion"
        Public Const IdUser As String = "s_IdUser"
        Public Const Fecpro As String = "s_Fecpro"
        Public Const Hora As String = "s_Hora"

	End Class
	#End Region		
	
	#Region "Properties" 
		Public Overridable Property IdPersona As String
			Get
				Return MyBase.GetString(ColumnNames.IdPersona)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdPersona, Value)
			End Set
		End Property

		Public Overridable Property ApePat As String
			Get
				Return MyBase.GetString(ColumnNames.ApePat)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.ApePat, Value)
			End Set
		End Property

		Public Overridable Property ApeMat As String
			Get
				Return MyBase.GetString(ColumnNames.ApeMat)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.ApeMat, Value)
			End Set
		End Property

		Public Overridable Property Nombres As String
			Get
				Return MyBase.GetString(ColumnNames.Nombres)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.Nombres, Value)
			End Set
		End Property

		Public Overridable Property Sexo As String
			Get
				Return MyBase.GetString(ColumnNames.Sexo)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.Sexo, Value)
			End Set
		End Property

		Public Overridable Property IdTipDocId As String
			Get
				Return MyBase.GetString(ColumnNames.IdTipDocId)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdTipDocId, Value)
			End Set
		End Property

		Public Overridable Property NroDocId As String
			Get
				Return MyBase.GetString(ColumnNames.NroDocId)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.NroDocId, Value)
			End Set
		End Property

		Public Overridable Property IdEstCivil As String
			Get
				Return MyBase.GetString(ColumnNames.IdEstCivil)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdEstCivil, Value)
			End Set
		End Property

		Public Overridable Property IdGradInst As String
			Get
				Return MyBase.GetString(ColumnNames.IdGradInst)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdGradInst, Value)
			End Set
		End Property

		Public Overridable Property IdProfesion As String
			Get
				Return MyBase.GetString(ColumnNames.IdProfesion)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdProfesion, Value)
			End Set
		End Property

		Public Overridable Property IdOcupacion As String
			Get
				Return MyBase.GetString(ColumnNames.IdOcupacion)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdOcupacion, Value)
			End Set
		End Property

		Public Overridable Property IdUser As String
			Get
				Return MyBase.GetString(ColumnNames.IdUser)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.IdUser, Value)
			End Set
		End Property

		Public Overridable Property Fecpro As DateTime
			Get
				Return MyBase.GetDateTime(ColumnNames.Fecpro)
			End Get
			Set(ByVal Value As DateTime)
				MyBase.SetDateTime(ColumnNames.Fecpro, Value)
			End Set
		End Property

		Public Overridable Property Hora As String
			Get
				Return MyBase.GetString(ColumnNames.Hora)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.Hora, Value)
			End Set
		End Property


	#End Region  
	
	#Region "String Properties" 

		Public Overridable Property s_IdPersona As String
			Get
				If Me.IsColumnNull(ColumnNames.IdPersona) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdPersona)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdPersona)
				Else
					Me.IdPersona = MyBase.SetStringAsString(ColumnNames.IdPersona, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_ApePat As String
			Get
				If Me.IsColumnNull(ColumnNames.ApePat) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.ApePat)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.ApePat)
				Else
					Me.ApePat = MyBase.SetStringAsString(ColumnNames.ApePat, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_ApeMat As String
			Get
				If Me.IsColumnNull(ColumnNames.ApeMat) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.ApeMat)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.ApeMat)
				Else
					Me.ApeMat = MyBase.SetStringAsString(ColumnNames.ApeMat, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Nombres As String
			Get
				If Me.IsColumnNull(ColumnNames.Nombres) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.Nombres)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Nombres)
				Else
					Me.Nombres = MyBase.SetStringAsString(ColumnNames.Nombres, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Sexo As String
			Get
				If Me.IsColumnNull(ColumnNames.Sexo) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.Sexo)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Sexo)
				Else
					Me.Sexo = MyBase.SetStringAsString(ColumnNames.Sexo, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdTipDocId As String
			Get
				If Me.IsColumnNull(ColumnNames.IdTipDocId) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdTipDocId)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdTipDocId)
				Else
					Me.IdTipDocId = MyBase.SetStringAsString(ColumnNames.IdTipDocId, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_NroDocId As String
			Get
				If Me.IsColumnNull(ColumnNames.NroDocId) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.NroDocId)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.NroDocId)
				Else
					Me.NroDocId = MyBase.SetStringAsString(ColumnNames.NroDocId, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdEstCivil As String
			Get
				If Me.IsColumnNull(ColumnNames.IdEstCivil) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdEstCivil)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdEstCivil)
				Else
					Me.IdEstCivil = MyBase.SetStringAsString(ColumnNames.IdEstCivil, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdGradInst As String
			Get
				If Me.IsColumnNull(ColumnNames.IdGradInst) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdGradInst)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdGradInst)
				Else
					Me.IdGradInst = MyBase.SetStringAsString(ColumnNames.IdGradInst, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdProfesion As String
			Get
				If Me.IsColumnNull(ColumnNames.IdProfesion) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdProfesion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdProfesion)
				Else
					Me.IdProfesion = MyBase.SetStringAsString(ColumnNames.IdProfesion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdOcupacion As String
			Get
				If Me.IsColumnNull(ColumnNames.IdOcupacion) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdOcupacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdOcupacion)
				Else
					Me.IdOcupacion = MyBase.SetStringAsString(ColumnNames.IdOcupacion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdUser As String
			Get
				If Me.IsColumnNull(ColumnNames.IdUser) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.IdUser)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdUser)
				Else
					Me.IdUser = MyBase.SetStringAsString(ColumnNames.IdUser, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fecpro As String
			Get
				If Me.IsColumnNull(ColumnNames.Fecpro) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fecpro)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fecpro)
				Else
					Me.Fecpro = MyBase.SetDateTimeAsString(ColumnNames.Fecpro, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Hora As String
			Get
				If Me.IsColumnNull(ColumnNames.Hora) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.Hora)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Hora)
				Else
					Me.Hora = MyBase.SetStringAsString(ColumnNames.Hora, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property IdPersona() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdPersona, Parameters.IdPersona)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property ApePat() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.ApePat, Parameters.ApePat)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property ApeMat() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.ApeMat, Parameters.ApeMat)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property Nombres() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.Nombres, Parameters.Nombres)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property Sexo() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.Sexo, Parameters.Sexo)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdTipDocId() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdTipDocId, Parameters.IdTipDocId)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property NroDocId() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.NroDocId, Parameters.NroDocId)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdEstCivil() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdEstCivil, Parameters.IdEstCivil)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdGradInst() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdGradInst, Parameters.IdGradInst)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdProfesion() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdProfesion, Parameters.IdProfesion)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdOcupacion() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdOcupacion, Parameters.IdOcupacion)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property IdUser() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdUser, Parameters.IdUser)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property Fecpro() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.Fecpro, Parameters.Fecpro)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property

			Public ReadOnly Property Hora() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.Hora, Parameters.Hora)
					Me._clause._entity.Query.AddWhereParemeter(where)
					Return where
				End Get
			End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property IdPersona() As WhereParameter 
			Get
				If _IdPersona_W Is Nothing Then
					_IdPersona_W = TearOff.IdPersona
				End If
				Return _IdPersona_W
			End Get
		End Property

		Public ReadOnly Property ApePat() As WhereParameter 
			Get
				If _ApePat_W Is Nothing Then
					_ApePat_W = TearOff.ApePat
				End If
				Return _ApePat_W
			End Get
		End Property

		Public ReadOnly Property ApeMat() As WhereParameter 
			Get
				If _ApeMat_W Is Nothing Then
					_ApeMat_W = TearOff.ApeMat
				End If
				Return _ApeMat_W
			End Get
		End Property

		Public ReadOnly Property Nombres() As WhereParameter 
			Get
				If _Nombres_W Is Nothing Then
					_Nombres_W = TearOff.Nombres
				End If
				Return _Nombres_W
			End Get
		End Property

		Public ReadOnly Property Sexo() As WhereParameter 
			Get
				If _Sexo_W Is Nothing Then
					_Sexo_W = TearOff.Sexo
				End If
				Return _Sexo_W
			End Get
		End Property

		Public ReadOnly Property IdTipDocId() As WhereParameter 
			Get
				If _IdTipDocId_W Is Nothing Then
					_IdTipDocId_W = TearOff.IdTipDocId
				End If
				Return _IdTipDocId_W
			End Get
		End Property

		Public ReadOnly Property NroDocId() As WhereParameter 
			Get
				If _NroDocId_W Is Nothing Then
					_NroDocId_W = TearOff.NroDocId
				End If
				Return _NroDocId_W
			End Get
		End Property

		Public ReadOnly Property IdEstCivil() As WhereParameter 
			Get
				If _IdEstCivil_W Is Nothing Then
					_IdEstCivil_W = TearOff.IdEstCivil
				End If
				Return _IdEstCivil_W
			End Get
		End Property

		Public ReadOnly Property IdGradInst() As WhereParameter 
			Get
				If _IdGradInst_W Is Nothing Then
					_IdGradInst_W = TearOff.IdGradInst
				End If
				Return _IdGradInst_W
			End Get
		End Property

		Public ReadOnly Property IdProfesion() As WhereParameter 
			Get
				If _IdProfesion_W Is Nothing Then
					_IdProfesion_W = TearOff.IdProfesion
				End If
				Return _IdProfesion_W
			End Get
		End Property

		Public ReadOnly Property IdOcupacion() As WhereParameter 
			Get
				If _IdOcupacion_W Is Nothing Then
					_IdOcupacion_W = TearOff.IdOcupacion
				End If
				Return _IdOcupacion_W
			End Get
		End Property

		Public ReadOnly Property IdUser() As WhereParameter 
			Get
				If _IdUser_W Is Nothing Then
					_IdUser_W = TearOff.IdUser
				End If
				Return _IdUser_W
			End Get
		End Property

		Public ReadOnly Property Fecpro() As WhereParameter 
			Get
				If _Fecpro_W Is Nothing Then
					_Fecpro_W = TearOff.Fecpro
				End If
				Return _Fecpro_W
			End Get
		End Property

		Public ReadOnly Property Hora() As WhereParameter 
			Get
				If _Hora_W Is Nothing Then
					_Hora_W = TearOff.Hora
				End If
				Return _Hora_W
			End Get
		End Property

		Private _IdPersona_W As WhereParameter = Nothing
		Private _ApePat_W As WhereParameter = Nothing
		Private _ApeMat_W As WhereParameter = Nothing
		Private _Nombres_W As WhereParameter = Nothing
		Private _Sexo_W As WhereParameter = Nothing
		Private _IdTipDocId_W As WhereParameter = Nothing
		Private _NroDocId_W As WhereParameter = Nothing
		Private _IdEstCivil_W As WhereParameter = Nothing
		Private _IdGradInst_W As WhereParameter = Nothing
		Private _IdProfesion_W As WhereParameter = Nothing
		Private _IdOcupacion_W As WhereParameter = Nothing
		Private _IdUser_W As WhereParameter = Nothing
		Private _Fecpro_W As WhereParameter = Nothing
		Private _Hora_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_IdPersona_W = Nothing
			_ApePat_W = Nothing
			_ApeMat_W = Nothing
			_Nombres_W = Nothing
			_Sexo_W = Nothing
			_IdTipDocId_W = Nothing
			_NroDocId_W = Nothing
			_IdEstCivil_W = Nothing
			_IdGradInst_W = Nothing
			_IdProfesion_W = Nothing
			_IdOcupacion_W = Nothing
			_IdUser_W = Nothing
			_Fecpro_W = Nothing
			_Hora_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property IdPersona() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdPersona, Parameters.IdPersona)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property ApePat() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.ApePat, Parameters.ApePat)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property ApeMat() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.ApeMat, Parameters.ApeMat)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Nombres() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Nombres, Parameters.Nombres)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Sexo() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Sexo, Parameters.Sexo)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdTipDocId() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdTipDocId, Parameters.IdTipDocId)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property NroDocId() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.NroDocId, Parameters.NroDocId)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdEstCivil() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdEstCivil, Parameters.IdEstCivil)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdGradInst() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdGradInst, Parameters.IdGradInst)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdProfesion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdProfesion, Parameters.IdProfesion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdOcupacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdOcupacion, Parameters.IdOcupacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdUser() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdUser, Parameters.IdUser)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fecpro() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fecpro, Parameters.Fecpro)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Hora() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Hora, Parameters.Hora)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property IdPersona() As AggregateParameter 
			Get
				If _IdPersona_W Is Nothing Then
					_IdPersona_W = TearOff.IdPersona
				End If
				Return _IdPersona_W
			End Get
		End Property

		Public ReadOnly Property ApePat() As AggregateParameter 
			Get
				If _ApePat_W Is Nothing Then
					_ApePat_W = TearOff.ApePat
				End If
				Return _ApePat_W
			End Get
		End Property

		Public ReadOnly Property ApeMat() As AggregateParameter 
			Get
				If _ApeMat_W Is Nothing Then
					_ApeMat_W = TearOff.ApeMat
				End If
				Return _ApeMat_W
			End Get
		End Property

		Public ReadOnly Property Nombres() As AggregateParameter 
			Get
				If _Nombres_W Is Nothing Then
					_Nombres_W = TearOff.Nombres
				End If
				Return _Nombres_W
			End Get
		End Property

		Public ReadOnly Property Sexo() As AggregateParameter 
			Get
				If _Sexo_W Is Nothing Then
					_Sexo_W = TearOff.Sexo
				End If
				Return _Sexo_W
			End Get
		End Property

		Public ReadOnly Property IdTipDocId() As AggregateParameter 
			Get
				If _IdTipDocId_W Is Nothing Then
					_IdTipDocId_W = TearOff.IdTipDocId
				End If
				Return _IdTipDocId_W
			End Get
		End Property

		Public ReadOnly Property NroDocId() As AggregateParameter 
			Get
				If _NroDocId_W Is Nothing Then
					_NroDocId_W = TearOff.NroDocId
				End If
				Return _NroDocId_W
			End Get
		End Property

		Public ReadOnly Property IdEstCivil() As AggregateParameter 
			Get
				If _IdEstCivil_W Is Nothing Then
					_IdEstCivil_W = TearOff.IdEstCivil
				End If
				Return _IdEstCivil_W
			End Get
		End Property

		Public ReadOnly Property IdGradInst() As AggregateParameter 
			Get
				If _IdGradInst_W Is Nothing Then
					_IdGradInst_W = TearOff.IdGradInst
				End If
				Return _IdGradInst_W
			End Get
		End Property

		Public ReadOnly Property IdProfesion() As AggregateParameter 
			Get
				If _IdProfesion_W Is Nothing Then
					_IdProfesion_W = TearOff.IdProfesion
				End If
				Return _IdProfesion_W
			End Get
		End Property

		Public ReadOnly Property IdOcupacion() As AggregateParameter 
			Get
				If _IdOcupacion_W Is Nothing Then
					_IdOcupacion_W = TearOff.IdOcupacion
				End If
				Return _IdOcupacion_W
			End Get
		End Property

		Public ReadOnly Property IdUser() As AggregateParameter 
			Get
				If _IdUser_W Is Nothing Then
					_IdUser_W = TearOff.IdUser
				End If
				Return _IdUser_W
			End Get
		End Property

		Public ReadOnly Property Fecpro() As AggregateParameter 
			Get
				If _Fecpro_W Is Nothing Then
					_Fecpro_W = TearOff.Fecpro
				End If
				Return _Fecpro_W
			End Get
		End Property

		Public ReadOnly Property Hora() As AggregateParameter 
			Get
				If _Hora_W Is Nothing Then
					_Hora_W = TearOff.Hora
				End If
				Return _Hora_W
			End Get
		End Property

		Private _IdPersona_W As AggregateParameter = Nothing
		Private _ApePat_W As AggregateParameter = Nothing
		Private _ApeMat_W As AggregateParameter = Nothing
		Private _Nombres_W As AggregateParameter = Nothing
		Private _Sexo_W As AggregateParameter = Nothing
		Private _IdTipDocId_W As AggregateParameter = Nothing
		Private _NroDocId_W As AggregateParameter = Nothing
		Private _IdEstCivil_W As AggregateParameter = Nothing
		Private _IdGradInst_W As AggregateParameter = Nothing
		Private _IdProfesion_W As AggregateParameter = Nothing
		Private _IdOcupacion_W As AggregateParameter = Nothing
		Private _IdUser_W As AggregateParameter = Nothing
		Private _Fecpro_W As AggregateParameter = Nothing
		Private _Hora_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_IdPersona_W = Nothing
		_ApePat_W = Nothing
		_ApeMat_W = Nothing
		_Nombres_W = Nothing
		_Sexo_W = Nothing
		_IdTipDocId_W = Nothing
		_NroDocId_W = Nothing
		_IdEstCivil_W = Nothing
		_IdGradInst_W = Nothing
		_IdProfesion_W = Nothing
		_IdOcupacion_W = Nothing
		_IdUser_W = Nothing
		_Fecpro_W = Nothing
		_Hora_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_PersonNatInsert]" 
	    
		CreateParameters(cmd)
		    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_PersonNatUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_PersonNatDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdPersona)
		p.SourceColumn = ColumnNames.IdPersona
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdPersona)
		p.SourceColumn = ColumnNames.IdPersona
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.ApePat)
		p.SourceColumn = ColumnNames.ApePat
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.ApeMat)
		p.SourceColumn = ColumnNames.ApeMat
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Nombres)
		p.SourceColumn = ColumnNames.Nombres
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Sexo)
		p.SourceColumn = ColumnNames.Sexo
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdTipDocId)
		p.SourceColumn = ColumnNames.IdTipDocId
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.NroDocId)
		p.SourceColumn = ColumnNames.NroDocId
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdEstCivil)
		p.SourceColumn = ColumnNames.IdEstCivil
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdGradInst)
		p.SourceColumn = ColumnNames.IdGradInst
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdProfesion)
		p.SourceColumn = ColumnNames.IdProfesion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdOcupacion)
		p.SourceColumn = ColumnNames.IdOcupacion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdUser)
		p.SourceColumn = ColumnNames.IdUser
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fecpro)
		p.SourceColumn = ColumnNames.Fecpro
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Hora)
		p.SourceColumn = ColumnNames.Hora
		p.SourceVersion = DataRowVersion.Current


	End Sub	
    
End Class

